var containerWrapper = document.getElementById('list')
var container = document.getElementById('container')
var openButton = document.getElementById('open')
var closeButton = document.getElementById('close')
initButton()

function initButton () {
    if(container.offsetHeight > containerWrapper.offsetHeight){
    openButton.style.visibility='visible'
    }else{
    openButton.style.visibility='hidden'
    }
    closeButton.style.visibility='hidden'
}
function onOpen () {
    console.log('open')
    containerWrapper.style.maxHeight ='99999px'//这里要设置一个足够大的值比如9999px
    openButton.style.visibility='hidden'
    closeButton.style.visibility='visible'
}
function onClose () {
    containerWrapper.style.maxHeight ='500px'
    openButton.style.visibility='visible'
    closeButton.style.visibility='hidden'
}